define(['app'], function(app) {
	'use strict';
	//实例化方法
	var factory = function(Http) {
		/**
		 * 一键切换数据获取方式
		 * @param {Object} result
		 */
		function get_data_getarticlelist(result) {
			if(false) {
				result = '{"success": true,"msg": "","result": {"article": [{"id": "001","cat_type_id": "001","cat_type_name": "大分类","question": "问题1","answer": "001"}, {"id": "002","cat_type_id": "001","cat_type_name": "大分类","question": "问题1","answer": "001"}]},"session": "7311da98bd0f18eb15a96bcb263f4153"}';
				return JSON.parse(result);
			} else {
				return result;
			}
		}
		
		//返回信息
		return {
			//常见问题搜索
			getlist: function(key,cat_type_id,nPage,callback,calldone) {
				Http.post({
					method: 'info.article.getlist',
					key:key,
                    cat_type_id: cat_type_id,
                    pagelimit:5,
                    nPage: nPage
				}, function(result) {
					//请求成功
					if(callback) {
						callback(get_data_getarticlelist(result).result);
					}
				}, function(e) {
					//请求异常
				}, function() {
					//请求完成，一般不做什么事情
					if(calldone)
						calldone();
				});
			}
			
		};
	}
	factory.$inject = ['Http'];
	return app.registerService("Proconsultproblem", factory);
});